﻿using System;
using NUnit.Framework;
using System.Linq.Expressions;

namespace NMA.Web.Tests.Controllers
{
    using NMA.Web.Core.CriteriaExpression;
    using NMA.Web.Areas.Admin.Models.SearchCriteria;
    using NMA.Web.Core.CriteriaExpression.Category;

    [TestFixture]
    public class HomeControllerTest
    {
        [Test]
        public void Test()
        {
            CategorySearchCriteria model = new CategorySearchCriteria();
            model.Id = Guid.NewGuid();
            model.Name = "testName";
            model.CreatedUser = "testUser";
            model.CreatedDate = DateTime.Now;

            CategorySearchCriteria testModel = new CategorySearchCriteria();
            testModel.Id = Guid.NewGuid();
            testModel.Name = "testName";
            testModel.CreatedUser = "testUser";
            testModel.CreatedDate = DateTime.Now;

            CriteriaExpressionFactory factory = new CriteriaExpressionFactory();
            Expression<Func<CategorySearchCriteria, bool>> expr = factory.CreateCategorySearchCriteria(model, SearchCategoryCriteriaType.IdAndName);
            var result = expr.Compile().Invoke(testModel);
        }
    }
}